package com.yuri.malldemo

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import com.yuri.libs.designsystem.theme.AppTheme
import com.yuri.libs.navigation.AppNavigator
import com.yuri.malldemo.navigation.AppNavHost
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject

@AndroidEntryPoint
class MainActivity : ComponentActivity() {

    @Inject
    lateinit var navigator: AppNavigator

    override fun onCreate(savedInstanceState: Bundle?) {
        val splashScreen = installSplashScreen()
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContent {
            // 应用主题包装
            AppTheme {
                // 设置应用的导航宿主，并传入导航管理器和路由注册器
                // 这样所有页面都可以通过导航管理器进行导航操作
                AppNavHost(navigator)
            }
        }

        // 不让启动界面一直显示
        splashScreen.setKeepOnScreenCondition {
            false
        }
    }
}